package org.elanfox.intellicommunity.biz.vo;

import lombok.Data;
import org.elanfox.intellicommunity.biz.entity.equipment.LocatorAreaPO;
import org.elanfox.intellicommunity.data.base.vo.BaseVO;

/**
 * @author allan
 * @version 1.0.0
 * @date 2/19/21
 */
@Data
public class LocatorAreaVO implements BaseVO {
    private static final long serialVersionUID = 6171671330349983373L;

    private Integer id;
    private String name;
    private int closestId;
    private String closestName;
    private int middleId;
    private String middleName;
    private int farawayId;
    private String farawayName;

    public LocatorAreaVO(LocatorAreaPO po) {
        this.id = po.getId();
        this.name = po.getName();
        if (po.getClosest() != null) {
            this.closestId = po.getClosest().getId();
            this.closestName = po.getClosest().getName();
        }
        if (po.getMiddle() != null) {
            this.middleId = po.getMiddle().getId();
            this.middleName = po.getMiddle().getName();
        }
        if (po.getFaraway() != null) {
            this.farawayId = po.getFaraway().getId();
            this.farawayName = po.getFaraway().getName();
        }
    }
}
